Skip to content

fix(runtime-artifacts): enforce cross-command artifact closeout - #175

Merged
Kucell merged 2 commits into
mainfrom
fix/runtime-artifact-closeout
Nov 7, 2026
Merged

Kucell merged 2 commits into
mainfrom
fix/runtime-artifact-closeout

Conversation

@Kucell

@Kucell Kucell commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Problem

The global runtime-artifact rule allowed conflicting readings, and the mechanical gate only understood a small set of Node file-write APIs. It missed the failure mode where an agent creates a script with apply_patch in /tmp and reuses it from later commands. It also missed shell redirection, tee, copy/move destinations, and --output arguments.

Change

  • Define artifact placement by lifetime and make cross-command reuse explicitly durable.
  • Add a task-closeout contract: every temp path must end as deleted, promoted, or owned_by_live_process.
  • Extend check-runtime-artifact-location to detect host patch targets, shell redirection, tee, cp, mv, Copy-Item, Move-Item, Out-File, and output flags.
  • Preserve process-local scratch with same-command cleanup evidence, and allow promotion from temp into .agent.
  • Update Chinese and English core-principles summaries and the general-mode AGENTS index.
  • Keep the language-neutral rule in _shared and remove the redundant English-layer copy.

Companion governance rule: https://github.com/Kucell/cortex-agent-agent/pull/42

Inner mirror: 06be413220dcf4e14f5a951d129536534688c3ec.

Validation

  • node --test tests/distribution/*.test.js: 83 passed, 0 failed.
  • node --test tests/init/init-mode-general.test.js tests/template/*.test.js: 53 passed, 0 failed, 1 expected skip.
  • pnpm check:parity: passed.
  • pnpm check:l1-distribution: passed with 0 violations.
  • pnpm check:runtime-artifact-location: 1,196 files, 0 violations.
  • pnpm check:portable-paths: 0 violations.
  • pnpm check:template-dedup: 0 duplicates.
  • SamHMI upgrade --dry-run --report json: 0 proposed additions, 0 blockers.

Upgrade

Existing projects receive the rule through the shared L1 template and the updated general-mode overlay. The checker remains a framework CI command and now catches the portable source/document patterns that previously bypassed it. Runtime-only host sessions still require the documented closeout inventory when the host has no blocking Stop hook.

cortex-agent added 2 commits November 7, 2026 14:19
Update the global rules to classify artifacts by lifetime and require task closeout for temporary paths.

Extend the mechanical gate to cover apply_patch targets, shell redirection, tee, copy/move destinations, and output flags. Remove the redundant English-layer rule copy.

Inner mirror: 06be413220dcf4e14f5a951d129536534688c3ec.
Advance the offline package and registry acceptance pins to the companion governance commit.
@Kucell
Kucell merged commit 5769662 into main Nov 7, 2026
5 checks passed
@Kucell
Kucell deleted the fix/runtime-artifact-closeout branch November 7, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant